const queue =[]; //push shift

queue.push(1);
queue.push(2);
queue.push(3);
queue.push(4);

while(queue){
    const top = queue.shift();
    console.log(top);
}